{
//set 用法
//增加add
  let list=new Set();
  list.add('venen');
  list.add('age');
  // console.log('size',list.size);
}
//set去数组中重复数据
{
  let arr=[1,2,4,4,5,"aa"];
  let list=new Set(arr);
  // console.log('list',list);
}

{
  let arr=[1,2,3,2,['a','b',3]];
  let list=new Set(arr);
  // console.log('listsize',list);
}
//add delete clear has
{
let arr=['add','delete','clear','has'];
let list=new Set(arr);
list.add('adds');
// console.log('has',list.has('adds'),list);
// console.log('clear',list.clear(),list);
// console.log('has',list);
}
//遍历set for of 
{
  let arr=[1,2,3,4,5,[6,7,8]];
  let list=new Set(arr);
  for(let key of list.keys()){
    // console.log('key',key);
  }
}
//遍历forEach
{
  let arr=[1,2,3,4,5,[6,7,8]];
  let list=new Set(arr);
  list.forEach(function(item){
    // console.log(item)
  })
}
{
  let arr=[1,2,3,4,5,[6,7,8]];
  let list=new Set(arr);
  for(let value of list.values()){
    // console.log('value',value);
  }
}
//set 下标和值都是一个
{
  let arr=[1,2,3,4,5,[6,7,8]];
  let list=new Set(arr);
  for(let [key,value] of list.entries()){
    // console.log('key,value',key,value);
  }
}
//普通数组就会打印下标
{
  let arr=[1,2,3,4,5,[6,7,8]];
  for(let [key,value] of arr.entries()){
    // console.log('key,value',key,value);
  }
}
//Map 定义方法
{
  let map=new Map();
  let a=[1,2];
  map.set(a,123);
  // console.log('map',map);
  // console.log('maplist',map.get(a))
  let arr=[['name','ven'],['age',50],['sex','nan']];
  let maps=new Map(arr);
  // console.log(maps.get('a'));
  for(let maplist of maps){
    console.log(maplist);
  }
}
//数据结构对比 增 查 改 删
{
  //map 增
  let map=new Map();
  let arr=[];
  map.set('name','venen');
  //普通数组 增
  arr.push({'name':'张'});
  // console.log('map,arr',map,arr);
  //map 查
  // console.log('has',map.has('name'));
  //普通数组 查
  // console.log('普通数组查',arr.find(item=>item.name))
  //map 改
  map.set('name','李四');
  console.log('map',map);
  //普通数组 改
  // for( let item of arr ){
  //   item.name="秒";
  //   console.log(item);
  // }
  arr.forEach(item=>item.name ? item.name='我':'1')

}